package com.test.service;

import com.test.dao.MerchantDao;
import com.test.domain.Merchant;
import com.test.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


@Component
public class MerchantService {

    private final MerchantDao merchantDao;

    @Autowired
    public MerchantService(MerchantDao merchantDao) {
        this.merchantDao = merchantDao;
    }

    //登录/注册业务
    public int registerAndLogin(User user){
        return merchantDao.registerAndLogin(user.getType(), user.getUsername(), user.getPassword());
    }

    //个人信息获取
    public Merchant merchantInfo(String phoneNumber){
        return merchantDao.getMerchantByPhoneNumber(phoneNumber);
    }

    //更新商铺名称
    public void updateShopName(Merchant merchant){
        merchantDao.updateShopName(merchant);
    }

    //更新工作状态
    public void updateIsWorking(Merchant merchant){
        merchantDao.updateIsWorking(merchant);
    }

    //更新商铺描述
    public void updateShopDescription(Merchant merchant){
        merchantDao.updateShopDescription(merchant);
    }



}
